# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=make-pdf
pkgver=0.1.7
pkgrel=4
pkgdesc='This tool will embed javascript inside a PDF document.'
arch=('any')
url='http://blog.didierstevens.com/programs/pdf-tools/'
groups=('blackarch' 'blackarch-forensic')
depends=('python2' 'dos2unix')
license=('GPL')
source=("http://www.didierstevens.com/files/software/make-pdf_V${pkgver//./_}.zip")
sha512sums=('b1019e81c6d28c62c89b823f425235401855699e79e5ac1ccc8830047cb7665286ff0f91219664d7b30ae4241c5b04ea840b477bec07dbdcd8c96f96b3a54c6d')

prepare(){
  grep -iRl 'python' "$srcdir" |
    xargs sed -i 's|#!.*/usr/bin/python|#!/usr/bin/python2|;s|#!.*/usr/bin/env python$|#!/usr/bin/env python2|'

  dos2unix *.py
}

package() {
  install -Dm 755 make-pdf-javascript.py "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 mPDF.py "$pkgdir/usr/lib/python2.7/site-packages/mPDF.py"
}

